package cn.geminis.crypto.csp.soft.ec;


import cn.geminis.crypto.csp.soft.AbstractSoftDigest;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.crypto.digests.SHA256Digest;

/**
 * @author Allen
 */
public class Sha256Digest extends AbstractSoftDigest {

    @Override
    protected org.bouncycastle.crypto.Digest createDigest() {
        return new SHA256Digest();
    }

    @Override
    public String getAlgorithmOid() {
        return NISTObjectIdentifiers.id_sha256.toString();
    }

    @Override
    public void setEncodedState(byte[] data) {
        ((SHA256Digest) this.digest).reset(new SHA256Digest(data));
    }

    @Override
    public byte[] getEncodedState() {
        return ((SHA256Digest) this.digest).getEncodedState();
    }
}
